/*
 * CommonUtility.h
 *
 *  Created on: Aug 15, 2011
 *      Author: mengwei.chua
 */

#ifndef COMMONUTILITY_H_
#define COMMONUTILITY_H_

#include <string>
#include "common/Buffer.h"

namespace projectcos
{
namespace common
{

const std::string indexTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

class CommonUtility
{
public:
	static std::string Base64Encode(const projectcos::common::Buffer<unsigned char>& data);
	static void Base64Decode(const std::string str, projectcos::common::Buffer<unsigned char>& data);

	static int Compress(const projectcos::common::Buffer<unsigned char>& inData, projectcos::common::Buffer<unsigned char>& outData);
	static int Decompress(const projectcos::common::Buffer<unsigned char>& inData, projectcos::common::Buffer<unsigned char>& outData);

protected:
private:
};

} // common
} // projectcos

#endif /* COMMONUTILITY_H_ */
